WIFI_MT7601U_SITE_METHOD = git
WIFI_MT7601U_SITE = https://github.com/openipc/mt7601u
WIFI_MT7601U_SITE_BRANCH = master
WIFI_MT7601U_VERSION = 0ac46553f3190d788b01c15cbeaa14f2951c55a3
# $(shell git ls-remote $(WIFI_MT7601U_SITE) $(WIFI_MT7601U_SITE_BRANCH) | head -1 | cut -f1)

WIFI_MT7601U_LICENSE = GPL-2.0

WIFI_MT7601U_MODULE_MAKE_OPTS = \
	KSRC=$(LINUX_DIR) \
	KVERSION=$(LINUX_VERSION_PROBED)

define WIFI_MT7601U_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WIRELESS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WIRELESS_EXT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_CORE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_PROC)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_PRIV)
	$(call KCONFIG_SET_OPT,CONFIG_CFG80211,y)
	$(call KCONFIG_SET_OPT,CONFIG_MAC80211,y)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_MINSTREL)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_MINSTREL_HT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_DEFAULT_MINSTREL)
	$(call KCONFIG_SET_OPT,CONFIG_MAC80211_RC_DEFAULT,"minstrel_ht")
endef

LINUX_CONFIG_LOCALVERSION = $(shell awk -F "=" '/^CONFIG_LOCALVERSION=/ {print $$2}' $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE))

define WIFI_MT7601U_INSTALL_CONFIGS
	$(INSTALL) -m 0755 -d $(TARGET_DIR)/lib/modules/3.10.14$(LINUX_CONFIG_LOCALVERSION)
	touch $(TARGET_DIR)/lib/modules/3.10.14$(LINUX_CONFIG_LOCALVERSION)/modules.builtin.modinfo

	$(INSTALL) -D -m 0644 $(@D)/MT7601USTA.dat \
		$(TARGET_DIR)/etc/mediatek/MT7601USTA.dat
endef

WIFI_MT7601U_POST_INSTALL_TARGET_HOOKS += WIFI_MT7601U_INSTALL_CONFIGS

$(eval $(kernel-module))
$(eval $(generic-package))
